import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Calendar
from pyecharts.globals import ThemeType
df=pd.read_excel('某店铺2023年1—9月份评价数据_预处理.xlsx')
df1=df.groupby('日期').count()
max=max(df1['评价'])
min=min(df1['评价'])
data=[list(z) for  z in zip(df1.index,df1['评价'])]
calendar=Calendar(init_opts=opts.InitOpts(theme=ThemeType.ESSOS,page_title='日历图'))
calendar.add(series_name='',yaxis_data=data,calendar_opts=opts.CalendarOpts(range_=['2023-01-01','2023-09-30']))
calendar.set_global_opts(
    title_opts=opts.TitleOpts(
        title='某店铺2023年1—9月份评价数据图',
        pos_left='center'),
        legend_opts=opts.LegendOpts(is_show=False),
        visualmap_opts=opts.VisualMapOpts(
            orient='horizontal',
            is_piecewise=True,
            pos_top='45%',
            pos_left='center'

        )
    )
calendar.render('例7-3.html')